<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/24
 * Time: 15:43
 */
namespace app\blog\model;
use think\Model;
use think\Db;
class IntroduceModel extends Model
{
    /***
     * 添加/更改公司简介
     */
    public function addPost($param){
        //判断是否存在该记录
        $rest = $this->find();
        if($rest == false){
            $date = array();
            $date['guid'] = guid();
            $date['name'] = $param['name'];
            $date['content'] = $param['content'];
            $rest1 = $this->insert($date);
            return $rest1;
        }else{
            $date = array();
            $date['name'] = $param['name'];
            $date['content'] = $param['content'];
            $rest1 = $this->where(['id'=>$rest['id']])->update($date);
            return $rest1;
        }
    }
    /***
     * 获得公司信息
     */
    public function getMsg(){
        $result = $this->find();
        return $result;
    }
}